<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="pg" uri="/tags/pagination"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<s:include value="../include.jsp"></s:include>
<title>菜单信息管理</title>
<script type="text/javascript">
	//进入新增画面
	function showAddMenu() {
		window.location = "showAddMenu!showAdd.action";
	}

	//查询
	function doQuery() {
		showBar();
		initPage("menuForm");
		chgAction("menuAction", "query");
		document.forms[0].submit();
	}

	//编辑
	function doEdit(menuName, menuSeq, menuId, parentId, menuCode,menuSort) {
		window.location = "showEditMenu!edit.action?menuName=" + menuName
				+ "&menuSeq=" + menuSeq + "&menuId=" + menuId + "&parentId="
				+ parentId + "&menuCode=" + menuCode + "&menuSort=" + menuSort;
	}

	//删除
	function doDelete(menuId) {
		if (confirm("是否确定删除此条数据？")) {
			showBar();
			initPage("menuForm");
			chgActionParamsNoShowBar("menuAction", "delete", "menuId=" + menuId);
			document.forms[0].submit();
		}
	}
	<s:if test="operateResult=='suc'">
	alert("删除成功");
	</s:if>
	<s:elseif test="operateResult=='fail'">
	alert("删除失败");
	</s:elseif>
	<s:elseif test="operateResult=='haveSub'">
	alert("该菜单下还存在子菜单，请先将子菜单删除后，再进行该菜单的删除");
	</s:elseif>
</script>
</head>
<body>
	<div class="outerDiv" style=" height:480px;overflow-y:auto;">
		<div class="top_box">
			您的位置：基础功能&gt;&gt;<span class="red">菜单信息管理</span>
		</div>
		<div class="form_list_box" align="center">
			<s:form action="menuAction" method="post" name="form1"
				namespace="/backend">
				<table width="100%" border="0">
					<tr>
						<td width="6%">菜单名称</td>
						<td align="left" width="20%"><s:textfield
								name="menuForm.menuName" id="menuName"></s:textfield></td>
						<td width="6%">菜单编号</td>
						<td align="left"><s:textfield name="menuForm.menuCode"
								id="menuCode"></s:textfield></td>
					</tr>
				</table>
				<div class="btn_box">
					<a href="#" onclick="doQuery()"><s></s>查询</a> &nbsp;&nbsp; <a
						href="#" onclick="showAddMenu()"><s></s>新增</a>
				</div>

				<table class="innerTable">
					<tr class="tableTitle">
						<td width="25%">菜单名称</td>
						<td width="20%">菜单编号</td>
						<td width="15%">菜单级别</td>
						<td width="8%">菜单顺序</td>
						<td width="20%">父菜单名称</td>
						<td>操作</td>
					</tr>
					<s:if test="menuList.size==0">
						<tr class="tableTextOdd">
							<td colspan="6" align="left"><font color="red">查无资料</font>
							</td>
						</tr>
					</s:if>
					<s:else>
						<s:iterator value="menuList" id="listInfo" status="st">
							<s:if test="#st.odd==true">
								<tr class="tableTextOdd">
							</s:if>
							<s:else>
								<tr class="tableTextEven">
							</s:else>
							<td align="left"><s:property value="menuName" />
							</td>
							<td align="center"><s:property value="menuCode" />
							</td>
							<td align="center"><s:property value="menuSeqDsp" />
							</td>
							<td align="center"><s:property value="menuSort" />
							</td>
							<td align="left"><s:property value="parentName"
									escape="false" /></td>
							</td>
							<td align="center"><span style="cursor: hand; color: blue"
								onclick="doEdit('<s:property value="menuName" />',
								'<s:property value="menuSeq" />',
								'<s:property value="menuId" />',
								'<s:property value="parentId" />',
								'<s:property value="menuCode" />','<s:property value="menuSort" />')">编辑</span>
								&nbsp; <span style="cursor: hand; color: blue"
								onclick="doDelete('<s:property value="menuId" />')">删除</span>
							</td>
							</tr>
							
						</s:iterator>
						<tr>
							<td colspan="6" align="center"><pg:pages
									curPageNo="%{menuForm.curPageNo}" total="%{menuForm.total}"
									totalRecord="%{menuForm.totalRecord}"
									styleClass="paginationSpan" method="query" action="menuAction"></pg:pages>
							</td>
						</tr>
					</s:else>
				</table>
				<s:include value="/common/include/pagination.jsp">
					<s:param name="formName" value="'menuForm'" />
				</s:include>
			</s:form>
		</div>
	</div>
</body>
</html>